package com.itheima.demo;

import com.itheima.demo01.Demo_Mythread03;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author Zhang_Han
 * @version 1.0
 * @date 2020/7/11 18:41
 */
public class Demo_Thread003 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Demo_Mythread03 th = new Demo_Mythread03();
        //创建管理器对象;
        FutureTask ft = new FutureTask<>(th);
        //创建线程对象;
        Thread t = new Thread(ft);
        //修改线程名称;
        t.setName("我是线程一");
        t.start();
        Object o = ft.get();
        System.out.println(o);
        for (int i = 0; i < 10; i++) {
            System.out.println("我是主线程"+i);
        }
    }
}
